﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;

namespace WMSSystem.WYJ.Dto
{
    /// <summary>
    /// 出库明细DTO
    /// </summary>
    public class OutboundDetailDto : AuditedEntityDto<Guid>
    {
        /// <summary>
        /// 出库单ID
        /// </summary>
        public Guid OutboundId { get; set; }

        /// <summary>
        /// 货品ID
        /// </summary>
        public Guid CommoditiesId { get; set; }

        /// <summary>
        /// 货品编号
        /// </summary>
        public string CommoditiesCode { get; set; }

        /// <summary>
        /// 货品名称
        /// </summary>
        public string CommoditiesName { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        public string CommoditiesGuike { get; set; }

        /// <summary>
        /// 单位名称
        /// </summary>
        public string UnitName { get; set; }

        /// <summary>
        /// 当前库存数量
        /// </summary>
        public int CurrentStock { get; set; }

        /// <summary>
        /// 本次出库数量
        /// </summary>
        public int OutboundQuantity { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 总金额
        /// </summary>
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 库位ID
        /// </summary>
        public Guid? PositionId { get; set; }

        /// <summary>
        /// 库位名称
        /// </summary>
        public string PositionName { get; set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime? ProductionDate { get; set; }

        /// <summary>
        /// 批次号
        /// </summary>
        public string BatchNumber { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }

    /// <summary>
    /// 创建出库明细DTO
    /// </summary>
    public class CreateOutboundDetailDto
    {
        /// <summary>
        /// 货品ID
        /// </summary>
        [Required]
        public Guid CommoditiesId { get; set; }

        /// <summary>
        /// 货品编号
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string CommoditiesCode { get; set; }

        /// <summary>
        /// 货品名称
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string CommoditiesName { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        [MaxLength(100)]
        public string CommoditiesGuike { get; set; }

        /// <summary>
        /// 单位名称
        /// </summary>
        [MaxLength(20)]
        public string UnitName { get; set; }

        /// <summary>
        /// 当前库存数量
        /// </summary>
        public int CurrentStock { get; set; }

        /// <summary>
        /// 本次出库数量
        /// </summary>
        [Required]
        [Range(1, int.MaxValue, ErrorMessage = "出库数量必须大于0")]
        public int OutboundQuantity { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        [Required]
        [Range(0, double.MaxValue, ErrorMessage = "单价不能为负数")]
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 库位ID
        /// </summary>
        public Guid? PositionId { get; set; }

        /// <summary>
        /// 库位名称
        /// </summary>
        [MaxLength(100)]
        public string PositionName { get; set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime? ProductionDate { get; set; }

        /// <summary>
        /// 批次号
        /// </summary>
        [MaxLength(50)]
        public string BatchNumber { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(200)]
        public string Remark { get; set; }
    }

    /// <summary>
    /// 更新出库明细DTO
    /// </summary>
    public class UpdateOutboundDetailDto
    {
        /// <summary>
        /// ID（更新时需要）
        /// </summary>
        public Guid? Id { get; set; }

        /// <summary>
        /// 货品ID
        /// </summary>
        [Required]
        public Guid CommoditiesId { get; set; }

        /// <summary>
        /// 货品编号
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string CommoditiesCode { get; set; }

        /// <summary>
        /// 货品名称
        /// </summary>
        [Required]
        [MaxLength(100)]
        public string CommoditiesName { get; set; }

        /// <summary>
        /// 规格型号
        /// </summary>
        [MaxLength(100)]
        public string CommoditiesGuike { get; set; }

        /// <summary>
        /// 单位名称
        /// </summary>
        [MaxLength(20)]
        public string UnitName { get; set; }

        /// <summary>
        /// 当前库存数量
        /// </summary>
        public int CurrentStock { get; set; }

        /// <summary>
        /// 本次出库数量
        /// </summary>
        [Required]
        [Range(1, int.MaxValue, ErrorMessage = "出库数量必须大于0")]
        public int OutboundQuantity { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        [Required]
        [Range(0, double.MaxValue, ErrorMessage = "单价不能为负数")]
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 库位ID
        /// </summary>
        public Guid? PositionId { get; set; }

        /// <summary>
        /// 库位名称
        /// </summary>
        [MaxLength(100)]
        public string PositionName { get; set; }

        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime? ProductionDate { get; set; }

        /// <summary>
        /// 批次号
        /// </summary>
        [MaxLength(50)]
        public string BatchNumber { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(200)]
        public string Remark { get; set; }
    }
}

